//
//  BoardViewController.h
//  CheckersGame
//
//  Created by  on 11-11-23.
//  Copyright (c) 2011 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "BoardView.h"
#import "Piece.h"

typedef int result;
#define DRAW 0
#define PLAYER1 +1
#define PLAYER2 -1

@class AppDelegate;

@interface BoardViewController : UIViewController {
    IBOutlet UILabel *bottomBarTitle;
    UIView* toplevelView;
    BoardView* boardView;
    NSArray* pieceArray; 
    CheckersGameState* gameState;
    Piece* selectedPiece;
    NSTimer* timer;
}

@property (strong, nonatomic) NSManagedObjectContext *managedObjectContext;
@property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel;
@property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator;
@property (strong, retain, nonatomic) IBOutlet UIView* toplevelView;
@property (strong, retain, nonatomic) IBOutlet BoardView* boardView;
@property float timeout;
@property (retain,nonatomic) NSString *player1;
@property (retain, nonatomic) NSString *player2;
@property BOOL pvp;
@property BOOL ai_player1;
@property BOOL ai_player2;
@property BOOL wroteGameResult;

// Methods for game board controller
- (void)newGame: (CheckersGameState*) gs;
- (void)pause;
- (void)suspend;
- (void)move;
- (IBAction)quit:(id)sender;
- (void)roll;
-(IBAction)didSelectUndo: (id)sender;
-(IBAction)didSelectPause: (id)sender;
-(IBAction)didSelectPiece: (id)sender;
-(IBAction)didClickBoard : (id)sender;
- (void)saveGameResult:(result)winner;
- (void)saveContext;
- (NSURL *)applicationDocumentsDirectory;

@end
